package com.x.config;

import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer;

/**
 * ClassName: SpringMvcInit
 * Package: IntelliJ IDEA
 *
 *
 * Description:
 * 初始化ioc容器、设置dispatcherServlet地址
 *
 * Written by HanXu
 * Create 2024.09.10 21:14
 */
public class SpringMvcInit extends AbstractAnnotationConfigDispatcherServletInitializer {

    //配置service层和mapper层的ioc容器
    @Override
    protected Class<?>[] getRootConfigClasses() {
        return new Class[0];
    }


    //设置项目的配置类
    @Override
    protected Class<?>[] getServletConfigClasses() {
        return new Class[]{MvcConfig.class};
    }


    //配置SpringMVC自带servlet的访问地址
    //String[]{"/"}代表所有地址
    @Override
    protected String[] getServletMappings() {
        return new String[]{"/"};
    }
}
